<?php
class Test extends CI_Model
{
	public function __construct()
	{
	 parent::__construct();
	 $this->db->database();
	}
	
	public function get_news($slug = FALSE)
	{
	  	if ($slug === FALSE)
	  	{
	    	$query = $this->db->get('user_info');
	    	return $query->result_array();
	  	}
	  
	 	 $query = $this->db->get_where('user_info', array('slug' => $slug));
	  	return $query->row_array();
	}
	
	function insert($arr)
	{
		$this->db->insert('user_info',$arr);
	}
	
	function update($id,$arr)
	{
		$this->db->where('id',$id);
		$this->db->update('user_info',$arr);
	}
	
	function delete($id)
	{
		$this->db->where('id',$id);
		$this->db->delete('user_info');
	}
	
	function select($id)
	{
		$this->db->where('id',$id);
		$this->db->select('*');
		$query=$this->db->get('user_info');
		return $query->result();
	}
}
?>